package com.young.msg.util;

import com.young.msg.model.SiteLetter;
import com.young.msg.model.SiteLetterReceive;
import com.young.msg.model.enums.ESiteLetterReadStatusEnum;

import java.util.Date;

/**
 * 对象工厂
 *
 * @author wangjy
 * @date 2021/11/13 16:04:37
 */
public class MsgPojoFactory {

    /**
     * 构造收信对象
     * @param siteLetter
     * @param userId
     * @param userName
     * @param receiveTime
     * @return
     */
    public static SiteLetterReceive buildSiteLetterReceive(SiteLetter siteLetter, String userId, String userName, Date receiveTime) {
        SiteLetterReceive receive = new SiteLetterReceive();
        receive.setLetterId(siteLetter.getId());
        receive.setReceiverUserId(userId);
        receive.setReceiverUserName(userName);
        receive.setReceiveTime(receiveTime);
        receive.setReadStatus(ESiteLetterReadStatusEnum.NO_READ.type);
        receive.setCreateTime(new Date());
        receive.setUpdateTime(new Date());
        return receive;
    }
}
